home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / X11R4 / cmds / X / ddx / mfb / RCS / mfbfont.c,v < prev    next >
Encoding:
Text File  |  1990-02-15  |  3.2 KB  |  118 lines

  1. head     1.1;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.1
  10. date     90.02.14.19.58.04;  author tve;  state Exp;
  11. branches ;
  12. next     ;
  13.  
  14.  
  15. desc
  16. @Original X11R4 distribution
  17. @
  18.  
  19.  
  20.  
  21. 1.1
  22. log
  23. @Initial revision
  24. @
  25. text
  26. @/*
  27. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
  28. and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
  29.  
  30.                         All Rights Reserved
  31.  
  32. Permission to use, copy, modify, and distribute this software and its 
  33. documentation for any purpose and without fee is hereby granted, 
  34. provided that the above copyright notice appear in all copies and that
  35. both that copyright notice and this permission notice appear in 
  36. supporting documentation, and that the names of Digital or MIT not be
  37. used in advertising or publicity pertaining to distribution of the
  38. software without specific, written prior permission.  
  39.  
  40. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  41. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  42. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  43. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  44. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  45. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  46. SOFTWARE.
  47.  
  48. */
  49. /* $XConsortium: mfbfont.c,v 1.16 89/03/18 12:28:12 rws Exp $ */
  50. #include "X.h"
  51. #include "Xmd.h"
  52. #include "Xproto.h"
  53. #include "fontstruct.h"
  54. #include "dixfontstr.h"
  55. #include "scrnintstr.h"
  56.  
  57. #include "mfb.h"
  58.  
  59. /*
  60.  * Take advantage of the per-screen private information field in the font to
  61.  * encode the results of fairly complex tests of the font's metric fields.
  62.  * ValidateFont need merely examine the code to select the output routines to
  63.  * be pointed to in the GC.
  64.  */
  65. Bool
  66. mfbRealizeFont( pscr, pFont)
  67.     ScreenPtr    pscr;
  68.     FontPtr    pFont;
  69. {
  70.     /*
  71.      * pGC->font is now known to be valid
  72.      */
  73.     int            index = pscr->myNum;
  74.     FontInfoPtr        pfi = pFont->pFI;
  75.     CharInfoPtr        maxb = &pfi->maxbounds;
  76.     CharInfoPtr        minb = &pfi->minbounds;
  77.  
  78.     /*
  79.      * pick the fastest output routines that can do the job.
  80.      */
  81.     if (   maxb->metrics.rightSideBearing -
  82.            minb->metrics.leftSideBearing > 32    /* big glyphs */
  83.       || pfi->drawDirection != FontLeftToRight
  84.       || pfi->noOverlap == 0)
  85.     pFont->devPriv[ index] = (pointer)FT_VARPITCH;
  86.     else  /* an optimizable case */
  87.     {
  88.     if (     maxb->metrics.leftSideBearing ==
  89.             minb->metrics.leftSideBearing /* fixed pitch */
  90.           && maxb->metrics.leftSideBearing == 0      /* fixed pitch */
  91.           && maxb->metrics.rightSideBearing ==
  92.                 minb->metrics.rightSideBearing /* fixed pitch */
  93.           && maxb->metrics.characterWidth ==
  94.                 minb->metrics.characterWidth  /* fixed pitch */
  95.           && maxb->metrics.ascent ==
  96.                 minb->metrics.ascent      /* fixed height */
  97.           && maxb->metrics.descent ==
  98.                 minb->metrics.descent)  /* fixed height */
  99.         pFont->devPriv[ index] = (pointer)FT_FIXPITCH;
  100.     else
  101.         pFont->devPriv[ index] = (pointer)FT_SMALLPITCH;
  102.     }
  103.     return (TRUE);
  104. }
  105.  
  106. /*
  107.  * no storage allocated in mfbRealizeFont, so there is nothing to do
  108.  */
  109. /*ARGSUSED*/
  110. Bool
  111. mfbUnrealizeFont( pscr, pFont)
  112.     ScreenPtr    pscr;
  113.     FontPtr    pFont;
  114. {
  115.     return (TRUE);
  116. }
  117. @
  118.